<?php

namespace Sharks\Core\Support\Cache;

use phpFastCache\CacheManager;
use Sharks\Core\AppContext;

/**
 * 使用phpFastCache的File文件缓存。
 * 详见 http://www.phpfastcache.com，或https://github.com/PHPSocialNetwork/phpfastcache
 */
class FileCacheFactory {

    private $cache = null;

    public function __construct(array $options = array()) {
        $defaultOptions = array(
            "storage"   =>  "files",
            "path"      =>  AppContext::instance()->path()->storage . "/cache",
        );
        array_merge($options, $defaultOptions);
        CacheManager::setup($options);
//            CacheManager::setup("path", $options['path']);

       $this->cache = CacheManager::getInstance();
    }

    public function instance() {
        return $this->cache;
    }

}